﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Common;

namespace dogd
{
	/// <summary>
	/// Interface used in repositories to create parameters immediately prior to executing
	/// DbCommand objects.
	/// </summary>
	public interface IParameterFactory
	{
		/// <summary>
		/// Create a parameter for use in a select statement based on key value
		/// </summary>
		/// <param name="key"></param>
		/// <param name="metadata"></param>
		/// <returns></returns>
		DbParameter CreateReadParameter(Key key, ColumnMetadata metadata);

		/// <summary>
		/// Create a parameter for use in a select statement based on string value
		/// </summary>
		/// <param name="id"></param>
		/// <param name="metadata"></param>
		/// <returns></returns>
		DbParameter CreateReadParameter(string id, ColumnMetadata metadata);

		/// <summary>
		/// Create a parameter for use in an update or insert statement based on 
		/// object values described by metadata
		/// </summary>
		/// <param name="value"></param>
		/// <param name="metadata"></param>
		/// <returns></returns>
		DbParameter CreateWriteParameter(object value, ColumnMetadata metadata);
	}
}
